package com.lixin.smartclassroom.ui.home.tab2.activity

import com.drake.brv.utils.bindingAdapter
import com.drake.net.utils.scopeNetLife
import com.lixin.smartclassroom.api.grouprenwulist
import com.lixin.smartclassroom.bean.DataListBean
import com.lixin.smartclassroom.databinding.FragmentRecyclerCustomBinding
import com.lixin.smartclassroom.ui.home.adapter.groupDetail
import com.lixinkeji.base.BaseActivity
import com.lixinkeji.extension.getIntentString
import com.lixinkeji.extension.gone
import com.lixinkeji.extension.visible

/**
 * Description 任务详情
 * Author: lwc
 * Date:2023/12/12 9:11
 */
class TaskDetailAct:BaseActivity<FragmentRecyclerCustomBinding>() {
    override fun getViewBinding() = FragmentRecyclerCustomBinding.inflate(layoutInflater)

    override fun title()="任务详情"
    override fun topBarHide() = false
    override fun startPadding() = true

    private var courseid=""
    private var groupid=""
    private lateinit var listBean :ArrayList<DataListBean>

    override fun iniView() {
        groupid = getIntentString("groupid")
        binding.recycler.groupDetail()

        binding.apply {
            refresh.onRefresh {
                scopeNetLife {
                    listBean = grouprenwulist(groupid,index , 10)!!
                    addData(listBean) {
                        if (binding.recycler.bindingAdapter.models?.size == 0) {
                            binding.state.showEmpty()
                            binding.recycler.gone()
                        } else {
                            binding.recycler.visible()
                        }
                        listBean.size == 10
                    }
                }
            }.autoRefresh()
        }

    }


}